<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="po.*" import="service.*"  import="dao.*"%>
<%! 
	private String div_myId;
	private Shop[] myShop;
%> 
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Cart</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/carts.css">
    
    
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<!-- Custom Theme files -->
<!--theme-style-->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />	
<!--//theme-style-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Shopin Responsive web template, Bootstrap Web Templates, Flat Web Templates, AndroId Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />

<!--theme-style-->
<link href="css/style4.css" rel="stylesheet" type="text/css" media="all" />	
<!--//theme-style-->
<script src="js/jquery.min.js"></script>
<!--- start-rate---->
<script src="js/jstarbox.js"></script>
	<link rel="stylesheet" href="css/jstarbox.css" type="text/css" media="screen" charset="utf-8" />
		<script type="text/javascript">
			jQuery(function() {
			jQuery('.starbox').each(function() {
				var starbox = jQuery(this);
					starbox.starbox({
					average: starbox.attr('data-start-value'),
					changeable: starbox.hasClass('unchangeable') ? false : starbox.hasClass('clickonce') ? 'once' : true,
					ghosting: starbox.hasClass('ghosting'),
					autoUpdateAverage: starbox.hasClass('autoupdate'),
					buttons: starbox.hasClass('smooth') ? false : starbox.attr('data-button-count') || 5,
					stars: starbox.attr('data-star-count') || 5
					}).bind('starbox-value-changed', function(event, value) {
					if(starbox.hasClass('random')) {
					var val = Math.random();
					starbox.next().text(' '+val);
					return val;
					} 
				})
			});
		});
		</script>
</head>
<body>
			<%
	div_myId = "<ul class=\"heart\"><li><a class=\"color\" href=\"buyer login.jsp\">Buyer login</a></li><li><a class=\"color\" href=\"seller login.jsp\">Seller login</a>				</li><li><a class=\"color\" href=\"supplier login.jsp\">Supplier login</a>				</li></ul>";
	if (session != null && session.getAttribute("login") != null && (boolean)session.getAttribute("login")) {
		div_myId = "<h3>" + "Your ID : " +  (String)session.getAttribute("myId") + "</h3>";
	}
	
	%>
	<div class="header">
<div class="container">
		<div class="head">
			<div class=" logo">
				<a href="index.jsp"><img src="images/2333.png" alt=""></a>	
			</div>
		</div>
	</div>
	<div class="header-top">
		<div class="container">
		
				
			<div class="col-sm-5 header-social">		
					<ul >
						<li><a href="#"><i></i></a></li>
						<li><a href="#"><i class="ic1"></i></a></li>
						<li><a href="#"><i class="ic2"></i></a></li>
						<li><a href="#"><i class="ic3"></i></a></li>
						<li><a href="#"><i class="ic4"></i></a></li>
					</ul>
					
			</div>
				<div class="clearfix"> </div>
		</div>
		</div>
		
		<div class="container">
		
			<div class="head-top">
			
		 <div class="col-sm-8 col-md-offset-2 h_menu4">
				<nav class="navbar nav_bottom" role="navigation">
 
 <!-- Brand and toggle get grouped for better mobile display -->
  <div class="navbar-header nav_2">
      <button type="button" class="navbar-toggle collapsed navbar-toggle1" data-toggle="collapse" data-target="#bs-megadropdown-tabs">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
     
   </div> 
   <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-megadropdown-tabs">
        <ul class="nav navbar-nav nav_1">
            <li><a class="color" href="home page.jsp">Home</a></li>
            
    		
			     <li><a class="color" href="cart.jsp">Cart</a>				
				</li>
			
			       <li><a class="color" href="order.jsp">Order</a>				
				</li>
				<li><a class="color">&nbsp;&nbsp;&nbsp;&nbsp;<h4>当前：购物车页面</h4></a></li>
			<!--<li><a class="color3" href="product.jsp">Sale</a></li>
			<li><a class="color4" href="404.jsp">About</a></li>
            <li><a class="color5" href="typo.jsp">Short Codes</a></li>
            <li ><a class="color6" href="contact.jsp">Contact</a></li>-->
        </ul>
     </div><!-- /.navbar-collapse -->

</nav>
			</div>
			<div class="col-sm-2 search-right">
				<div class="myId">
				<%= div_myId %>
				
				</div>
				
					<div class="cart box_1">
					
						<h3> <div class="total">
							<span class="simpleCart_total"></span></div>
							

					</div>
					<div class="clearfix"> </div>
					
						<!----->

						<!---pop-up-box---->					  
			<link href="css/popuo-box.css" rel="stylesheet" type="text/css" media="all"/>
			<script src="js/jquery.magnific-popup.js" type="text/javascript"></script>
			<!---//pop-up-box---->
			<div id="small-dialog" class="mfp-hide">
				<div class="search-top">
				
				
				</div>				
			</div>
		 <script>
			$(document).ready(function() {
			$('.popup-with-zoom-anim').magnificPopup({
			type: 'inline',
			fixedContentPos: false,
			fixedBgPos: true,
			overflowY: 'auto',
			closeBtnInside: true,
			preloader: false,
			midClick: true,
			removalDelay: 300,
			mainClass: 'my-mfp-zoom-in'
			});
																						
			});
		</script>		
						<!----->
			</div>
			<div class="clearfix"></div>
		</div>	
	</div>	
</div>



    <section class="cartMain">
        <div class="cartMain_hd">
            <ul class="order_lists cartTop">
                <li class="list_chk">
                    <!--所有商品全选-->
                </li>
                <li class="list_con">Commodity Info</li>
                <li class="list_info">Commodity Parameters</li>
                <li class="list_price">Unit Price</li>
                <li class="list_amount">Number</li>
                <li class="list_sum">Amount Of Money</li>
                <li class="list_op">SellerName</li>
            </ul>
        </div>

        <div class="cartBox">
            
            <div class="order_content">
                <form id="form1">
                	<%
                	if (session.getAttribute("login") == null || !(boolean)session.getAttribute("login")) {
                		%>
                			<p><h2>not login.</h2></p>
                		<%
                	} else {
                	myShop = BuyerService.getShoppingCart((String)session.getAttribute("myId"));
                    		int i = 0;
                    for (Shop s: myShop) {
                    	i++;
						Product p = new Product();
						p.setid(s.getProductId());
						ProductDao.queryOneRecord(p);
                	%>
                	<ul class="order_lists">
                    <li class="list_con">
                        <div class="list_img"><a href="javascript:;"><img src="images/<%= i%5 + 1 %>.png" alt=""></a></div>
                        <div class="list_text"><a href="javascript:;"><%= p.getName() %></a></div>
                    </li>
                    <li class="list_info">
                        <%= p.getInfo() %>
                    </li>
                    <li class="list_price">
                        <p class="price">$<%= p.getPrice() %></p>
                    </li>
                    <li class="list_amount">
                        <div class="amount_box">
                            <p><%= s.getAmount() %></p>
                        </div>
                    </li>
                    <li class="list_sum">
                        <p class="sum_price">$<%= s.getAmount()*p.getPrice() %></p>
                    </li>
                    <li class="list_sum">
                        <p class="sum_price"><%= s.getSellerId() %></p>
                    </li>
                </ul>
                	<%}} %>
                </form>
            </div>
        </div>



        
        <!--底部-->
        <div class="bar-wrapper">
            <div class="bar-right">
                <div class="calBtn"><a style="background: #f40" href="javascript:;" onclick="submit1()" >结算</a></div>
            </div>
        </div>
    </section>
	    <script type="text/javascript" >
        function submit1()//第二种提交方式，用普通button按钮结合JavaScript提交
        {
            var form1=document.getElementById("form1");
            form1.action="SettlementServlet";                //设置提交路径
            form1.method="post";
            form1.submit();                            //提交
        }
    </script>
	
	
	
</body>
</html>